<?xml version="1.0"?>

<f:view
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ice="http://www.icesoft.com/icefaces/component"
	xmlns:icecore="http://www.icefaces.org/icefaces/core"
	xmlns:liferay-ui="http://portletfaces.org/liferayfaces/liferay-ui"
	xmlns:liferay-util="http://portletfaces.org/liferayfaces/liferay-util"
	xmlns:ui="http://java.sun.com/jsf/facelets"
>
	<h:head />
	<h:body>
	
	<ice:form id="tipoForm" enctype="multipart/form-data">
		<ice:panelGrid id="tipo" columns="4">
			
		<ice:outputText id="active" value="#{i18n['active']}"/>
		<ice:selectBooleanCheckbox id="activeIn" value="#{tipoBean.tipo.activo}"/>
		
		</ice:panelGrid>
		<ice:panelGrid id="lenguajeTipo">
			<ice:dataTable id="languages" var="language" value="#{tipoBean.languagesElement}" rendered="#{tipoBean.languagesElement.size() > 0}" width="300px">
				<ice:column styleClass="language.estilo">						
					<ice:rowSelector selectionListener="#{tipoBean.selectionListener}">
						<ice:panelGrid columns="5">								
							<ice:outputText value="#{i18n['language']}" />	
							<ice:selectOneMenu value="#{language.language}" partialSubmit="true" valueChangeListener="#{tipoBean.checkLanguage}" >
								<f:selectItems value="#{tipoBean.languages}" />
							</ice:selectOneMenu>
							<ice:outputText value="#{i18n['name']}" />
							<ice:inputText size="50" maxlength="50" partialSubmit="true" value="#{language.name}"/>
						</ice:panelGrid>
						<ice:panelGrid columns="2">
							<ice:outputText value="#{i18n['description']}" />
							<ice:inputTextarea rows="2" cols="50" maxlength="250" partialSubmit="true" value="#{language.description}"/>								
						</ice:panelGrid>
					</ice:rowSelector>													
				</ice:column>	
			</ice:dataTable>
			<h:panelGrid columns="2">
				<h:commandButton id="add" value="#{i18n['add']}" action="#{tipoBean.addLanguage()}" >
					<f:ajax render="@form"/>
				</h:commandButton>
				<h:commandButton id="less" value="#{i18n['delete']}" action="#{tipoBean.lessLanguage()}" >
					<f:ajax render="@form"/>
				</h:commandButton>
			</h:panelGrid>
		</ice:panelGrid>
		
		<h:commandButton id="agree" value="#{i18n['agree']}" action="#{tipoBean.saveTipo()}">
			<f:ajax render="@form"/>
		</h:commandButton>
		<h:commandButton id="cancel" value="#{i18n['cancel']}" action="#{tipoBean.doCancel()}">
			<f:ajax render="@form"/>
		</h:commandButton>
			
	</ice:form>
		
	</h:body>
</f:view>